// --------------------------------------------------------------------------------------------------------------------- 
// <copyright file="ITSEventQueueService.cs" company="Scrum for Team System">
//   None
// </copyright>
// <summary>
//   Defines the IEventQueueService type.
// </summary>
// ---------------------------------------------------------------------------------------------------------------------
namespace ScrumForTeamSystem.EventService.Infrastructure.Interfaces
{
    using System;

    /// <summary>
    /// Defines the event queue service interface
    /// </summary>
    public interface IEventQueueService : IMessageProducer
    {
        /// <summary>
        /// Occurs when [object enqueued] event raised.
        /// </summary>
        event EventHandler ObjectEnqueued;

        /// <summary>
        /// Gets a value indicating whether this instance has queued events.
        /// </summary>
        /// <value>
        /// <c>true</c> if this instance has queued events; otherwise, <c>false</c>.
        /// </value>
        bool HasQueuedEvents
        {
            get;
        }

        /// <summary>
        /// Peeks the queued events.
        /// </summary>
        /// <returns>An array of events without dequing.</returns>
        ITfsEvent[] PeekQueuedEvents();

        /// <summary>
        /// Peeks the type of the queued events by event.
        /// </summary>
        /// <param name="eventType">The event type.</param>
        /// <returns>An array of events filtered by type, without dequing</returns>
        ITfsEvent[] PeekQueuedEventsByEventType(Type eventType);

        /// <summary>
        /// Enqueues the specified event source.
        /// </summary>
        /// <param name="eventSource">The event source.</param>
        /// <param name="serverIdentity">The server identity.</param>
        void Enqueue(object eventSource, TFSIdentity serverIdentity);

        /// <summary>
        /// Dequeues this instance.
        /// </summary>
        /// <returns>The dequed event instance</returns>
        ITfsEvent Dequeue();
    }
}